﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Koonsoft.CustomerService.Entity;
using Koonsoft.CustomerService.BLL;

namespace CustomerService.ReportIssues
{
    public partial class StateUpdate : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Guid guid = Guid.Empty;
                try
                {
                    guid = Guid.Parse(Request["Guid"].ToString());

                }
                catch
                {
                    AlterCloseReturn("GUID错误", "");
                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Guid guid = Guid.Empty;
            try
            {
                guid = Guid.Parse(Request["Guid"].ToString());

                string msg;
                Issue issue = new IssuesBLL().GetIssues(new Issue() { IssueID = guid, Status = -1 }, out msg).FirstOrDefault();

               

                try
                {

                    if (new IssuesBLL().Update(issue,LoginName,txtMark.Text,out msg) )
                    {
                        AlterAndRedirect("处理成功", "../Default.aspx");
                    }
                    else
                    {
                        AlertMsg("处理失败，请联系管理员");
                    }
                }
                catch
                {
                    AlertMsg("出错，请联系管理员");
                }
            }
            catch
            {
                AlterCloseReturn("GUID错误", "");
            }


        }
    }
}